﻿@using Telerik.Web.Mvc.UI;
@using IT.CMS.Web.Framework.Web;
@using IT.CMS.Services.Security;
@using IT.CMS.Core.Domain.Security;

@{
    
                    if (!Telerik.Web.Mvc.SiteMapManager.SiteMaps.ContainsKey("Vertical_Menu"))
                    {
                        Telerik.Web.Mvc.SiteMapManager.SiteMaps.Register<Telerik.Web.Mvc.XmlSiteMap>("Vertical_Menu", sitemap => sitemap.LoadFrom("~/Areas/Admin/Vertical_Menu.config"));
                    } 

                    Telerik.Web.Mvc.XmlSiteMap SiteDic = (Telerik.Web.Mvc.XmlSiteMap)Telerik.Web.Mvc.SiteMapManager.SiteMaps["Vertical_Menu"];
                    
                    if (SiteDic.RootNode.ChildNodes.Count > 0) 
                    { 
                        <ul class="nav nav-pills nav-stacked wide" style="position:absolute;">
                            <li class="header" style="height:20px; text-align:center; color:white;font-weight:bold;">
                            @(EngineContext.Current.Resolve<IT.CMS.Services.Helpers.IDateTimeHelper>().ConvertToUserTime(DateTime.Now).ToString("f"))
                            </li>
                            <li class="darker"><form class="form-search"><input type="text" class="input-medium search-query"></form></li>
                                                
                    @foreach (var item in SiteDic.RootNode.ChildNodes)
                    {

                        Dictionary<string, object> itemModel = new Dictionary<string, object>();
                        
                        itemModel["ActionName"] = item.ActionName;
                        itemModel["ControllerName"] = item.ControllerName;
                        
                        itemModel["ResourceName"] = item.Attributes["cmsResource"].ToString();
                        itemModel["IconClass"] = item.Attributes["IconClass"].ToString();
                        itemModel["ChaildNodesCount"] = (item.ChildNodes != null) ? item.ChildNodes.Count() : 0;

                        
                        @Html.Partial("_Vertical_Menu_Node", itemModel)

                        
                        if (int.Parse(itemModel["ChaildNodesCount"].ToString()) > 0)
                        {
                            <ul class="dropdown-menu">

                            @foreach (var itemLevel2 in item.ChildNodes)
                            {

                                Dictionary<string, object> itemModelLevel2 = new Dictionary<string, object>();

                                itemModelLevel2["ActionName"] = itemLevel2.ActionName;
                                itemModelLevel2["ControllerName"] = itemLevel2.ControllerName;

                                itemModelLevel2["ResourceName"] = itemLevel2.Attributes["cmsResource"].ToString();
                                itemModelLevel2["IconClass"] = (itemLevel2.Attributes["IconClass"] != null) ? itemLevel2.Attributes["IconClass"].ToString() : null;
                                itemModelLevel2["ChaildNodesCount"] = (itemLevel2.ChildNodes != null) ? itemLevel2.ChildNodes.Count() : 0;
                                @Html.Partial("_Vertical_Menu_Node", itemModelLevel2)
                                
                            }
                                </ul>
                    }
                    

                            
                            
                            
                            
                        }

                    }
                            

<li>
    <div class="accordion" id="accordion2">
  <div class="accordion-group">
    <div class="accordion-heading">
      <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseOne">
        <i class="micon-calculate"></i>
        <span>Collapsible Group Item #1</span>
      </a>
    </div>
    <div id="collapseOne" class="accordion-body collapse in">
      <div class="accordion-inner">
        <ul class="nav nav-pills nav-stacked wide">
            <li><a href="/Admin" class="" data-toggle=""><i class="micon-screen"></i><span>Dashboard</span></a></li>
            <li><a href="/Admin" class="" data-toggle=""><i class="micon-screen"></i><span>Dashboard</span></a></li>
            <li><a href="/Admin" class="" data-toggle=""><i class="micon-screen"></i><span>Dashboard</span></a></li>
            <li><a href="/Admin" class="" data-toggle=""><i class="micon-screen"></i><span>Dashboard</span></a></li>
            <li><a href="/Admin" class="" data-toggle=""><i class="micon-screen"></i><span>Dashboard</span></a></li>
        </ul>
      </div>
    </div>
  </div>
  <div class="accordion-group">
    <div class="accordion-heading">
      <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseTwo">
        Collapsible Group Item #2
      </a>
    </div>
    <div id="collapseTwo" class="accordion-body collapse">
      <div class="accordion-inner">
        <ul class="nav nav-pills nav-stacked wide">
            <li><a href="/Admin" class="" data-toggle=""><i class="micon-screen"></i><span>Dashboard</span></a></li>
            <li><a href="/Admin" class="" data-toggle=""><i class="micon-screen"></i><span>Dashboard</span></a></li>
            <li><a href="/Admin" class="" data-toggle=""><i class="micon-screen"></i><span>Dashboard</span></a></li>
            <li><a href="/Admin" class="" data-toggle=""><i class="micon-screen"></i><span>Dashboard</span></a></li>
            <li><a href="/Admin" class="" data-toggle=""><i class="micon-screen"></i><span>Dashboard</span></a></li>
        </ul>        
      </div>
    </div>
  </div>
</div>
                                               </li> 


                            </ul>                
                    }
}